#!/bin/bash

project=/c/Brook/work/work/linux/linux
output_dir=/c/Brook/work/work/vim/linux
output_file=$output_dir/cscope.files
exclude_dirs=(
    .git
    )

if [ ! -d "$output_dir" ]; then
    mkdir -p $output_dir
fi

cmd="find $project"
for dir in "${exclude_dirs[@]}"
do
    cmd+=" -path \"$project/$dir/*\" -prune -o"
done
cmd+=" \\( -iname '*.c' -or -iname '*.cpp' -or -iname '*.h' \\) -print > $output_file"

eval $cmd
sed -i 's/\//\\/g' $output_file
sed -i 's/^\\\([^\\]*\)/\1:/g' $output_file
